package ift604.projet.music;

import org.json.simple.JSONObject;

import android.database.Cursor;

public class Song {
    private String title = "";
    private String imageURL = "";
    private String artist = "";
    private String fileURL = "";

    public static Song songFromStereoMoodJSON(JSONObject stereoMood){
        Song song = new Song();
        song.title = (String) stereoMood.get("title");
        song.imageURL = (String) stereoMood.get("image_url");
        song.artist = (String) stereoMood.get("artist");
        song.fileURL = (String) stereoMood.get("audio_url");
        return song;
    }

    public static Song songFromDB(Cursor cursor){
        Song song = new Song();
        song.title = cursor.getString(cursor.getColumnIndex(SQLPlaylistRepository.C_SONG_TITLE));
        //song.imageURL = (String) stereoMood.get("image_url");
        //song.artist = (String) stereoMood.get("artist");
        song.fileURL = cursor.getString(cursor.getColumnIndex(SQLPlaylistRepository.C_SONG_URL));
        return song;
    }
    
    private Song(){

    }

    public String title(){
        return title;
    }

    public String imageURL(){
        return imageURL;
    }

    public String artist(){
        return artist;
    }

    public String fileURL(){
        return fileURL;
    }
}
